banData = getPlayerData("ban", playername, writeNew = "0")
if banData != 0:
    banTime = int(banData.split("+")[1].split(", ")[0])
    banStartTime = int(banData.split("+")[0])
    banStartTimeFormat = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(banStartTime))
    banToTime = banStartTime+banTime
    banToTimeFormat = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(banToTime))
    banRemTime = banToTime-int(time.time())
    operator = banData.split(", ", 3)[2]
    server = banData.split(", ", 3)[1]
    why = banData.split(", ", 3)[3]
    if banRemTime > 0:
        M, S = divmod(banRemTime, 60)
        H, M = divmod(M, 60)
        D, H = divmod(H, 24)
        banRemTimeFormat = "%sDays %sHours %sMinutes %sSeconds" % (D, H, M, S)
        tellrawText("@a", "§l§4Warning§r", "§c§l%s§r§c 已被 §l%s§r§c 在服 §l%s§r§c 封禁, 已踢出\n剩余时长: §l%s§r§c\n封禁时间: §l%s§r§c\n解封时间: §l%s§r§c\n原因: §l%s§r§c" % (playername, operator, server, banRemTimeFormat, banStartTimeFormat, banToTimeFormat, why))
        sendcmd("/kick %s §c§l你§r§c 已被 §l%s§r§c 在服 §l%s§r§c 封禁, 已踢出\n剩余时长: §l%s§r§c\n封禁时间: §l%s§r§c\n解封时间: §l%s§r§c\n原因: §l%s§r§c" % (playername, operator, server, banRemTimeFormat, banStartTimeFormat, banToTimeFormat, why))
